home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Opus5.5
/
ARexx.lha
/
ARexx
/
Virus_Checker7.dopus5
< prev
next >
Wrap
Text File
|
1996-06-13
|
6KB
|
170 lines
/* Virus_Checker7 for Directory Opus 5.5 and Virus_Checker 7 or 8.
by Leo 'Nudel' Davidson for Gods'Gift Utilities
email: leo.davidson@keble.oxford.ac.uk www: http://users.ox.ac.uk/~kebl0364
$VER: Virus_Checker7 1.4 (7.1.96)
NOTE: Also works with Virus_Checker 8.4 as well as the old Virus_Checker 7.
If you include the path of a file/dir on the command line, using a {}, only
this file/dir will be tested. If you omit the {}, the program will check
all selected files and directories in the SOURCE lister for viruses.
If Virus_Checker's ARexx port is not found, the program will be run for
you (you should edit the path below). This means the script may fail if
you give an incorrect path to the Virus_Checker program.
If the Virus_Checker's ARexx port takes over a minute to appear, an error
requester will appear on the DOpus screen and the script will quit.
If Virus_Checker was running to start with, it will be left running after
the script has completed. Otherwise, it will be removed from memory.
When a virus is detected a beep will sound and once all files have been
checked you will get a requester with a list of infected files (including
the type of virus). It is possible that the requester will fail to
appear if it becomes too large to fit on the screen. The script will
detect when this happens and output the results to a shell window instead.
Thanks to John Veldthuis <johnv@tower.actrix.gen.nz> for writting
Virus_Checker, allowing me access to the VC7/8 beta versions, and for giving
me a virus-infected file (!) to test this script with.
For a "check selected files for viruses" function, call as:
------------------------------------------------------------------------------
ARexx DOpus5:ARexx/Virus_Checker7.dopus5 {Qp} {Ql}
------------------------------------------------------------------------------
Turn off all switches.
For an "Un-LhA to a directory and check for viruses" function, call as:
------------------------------------------------------------------------------
AmigaDOS C:LHA -M x {fu} {d}{ou-}/
ARexx DOpus5:ARexx/Virus_Checker7.dopus5 {Qp} {Ql} {d}{o-}
------------------------------------------------------------------------------
Switches: Do all files
Output to window
Rescan dest
Window close button
//- Path to Virus_Checker command ------------------------------------------*/
Virus_Checker = "DH0:Tools/Virus/Virus_Checker"
/*--------------------------------------------------------------------------*/
options results
options failat 99
signal on syntax;signal on ioerr /* Error trapping */
parse arg DOpusPort source_handle.0 FilePath
DOpusPort = Strip(DOpusPort,"B",'" ')
source_handle.0 = Strip(source_handle.0,"B",'" ')
/* Important: FilePath must be stripped as below incase there is a space at
the beginning or end of the filename */
FilePath = Strip(Strip(FilePath,"B",' '),"B",'"')
If DOpusPort="" THEN Do
Say "Not correctly called from Directory Opus 5!"
Say "Load this ARexx script into an editor for more info."
EXIT
END
If ~Show("P",DOpusPort) Then Do
Say DOpusPort "is not a valid port."
EXIT
End
Address value DOpusPort
dopus version
If ( result='RESULT' | translate(result,'.',' ') < 5.1218 ) then do
dopus request '"This script requires DOpus v5.5 or greater." OK'
EXIT
end
Quit_After = "NO"
If ~Show("P","Virus_Checker") Then Do
Address Command Virus_Checker
Address Command "WaitForPort Virus_Checker"
Quit_After = "YES"
If ~Show("P","Virus_Checker") then do
lister request source_handle.0 '"Error loading Virus_Checker!'|| '0a'x ||'Check its command-path in the ARexx script." OK'
EXIT
END
END
/* If file/dir-path was specified on command line, check it, else
go through all the selected ones. */
BadList = ""
BadNumber = 0
If FilePath = "" Then Do
lister set source_handle.0 busy 1
lister query source_handle.0 numselentries /* Get info about selected */
Lister_NumSelEnt = RESULT /* entries & path to them */
lister query source_handle.0 path
Lister_Path = Strip(RESULT,"B",'"')
lister set source_handle.0 progress Lister_NumSelEnt "Checking for viruses..."
Do i=1 to Lister_NumSelEnt
lister query source_handle.0 abort
If RESULT=1 Then BREAK
lister query source_handle.0 firstsel
Temp_Name = Strip(RESULT,"B",'"')
lister select source_handle.0 '"'||Temp_Name||'"' 0
Temp_Path = Lister_Path || Temp_Name
lister set source_handle.0 progress name Temp_Name
lister set source_handle.0 progress count i
Address "Virus_Checker" "Scan "||Temp_Path
If VCHECK.0.0 ~= 0 Then Do
command beep
Do x=1 to VCHECK.0.0
BadNumber = BadNumber + 1
BadList = BadList || '0a'x || VCHECK.x.1 ||" (" || VCHECK.x.2 || ")"
END
END
END
lister clear source_handle.0 progress
End
ELSE Do
lister set source_handle.0 progress "-1" "Checking for viruses..."
Address "Virus_Checker" "Scan "||FilePath
If VCHECK.0.0 ~= 0 Then Do
command beep
Do x=1 to VCHECK.0.0
BadNumber = BadNumber + 1
BadList = BadList || '0a'x || VCHECK.x.1 ||" (" || VCHECK.x.2 || ")"
END
END
lister clear source_handle.0 progress
End
If BadNumber > 0 Then Do
If BadNumber = 1 Then
BadNote = "The following file is infected: 0m(Virus name in parenthesis)"
Else
BadNote = "The following files are infected: 0m(Virus names in parenthesis)"
BadList = "0;41;30m *VIRUS WARNING* 0m" || '0a'x || "1m" || BadNote || '0a'x || BadList
dopus front
dopus screen
doscr = RESULT ; dosname=Word(doscr,"1") ; dosbar=Word(doscr,"5")+1 ; doswidth=Word(doscr,"2") ; dosheight=Word(doscr,"3")-dosbar
Open(Output_Shell,"CON:0/"|| dosbar ||"/"|| doswidth ||"/"|| dosheight ||"/Virus Warning/CLOSE/WAIT/SCREEN"|| dosname,"W")
WriteLN(Output_Shell,BadList)
command wait alarm
Close(Output_Shell)
END
/*-- Restore the Lister for normal use --------------------------------------*/
syntax:;ioerr: /* In case of error, jump here */
END_PART_2:
lister clear source_handle.0 progress
If FilePath = "" Then Do
lister refresh source_handle.0
lister set source_handle.0 busy 0
END
END_PART:
If Quit_After = "YES" Then Address "Virus_Checker" QUIT
EXIT